const url = new URL("https://example.com:8888/path?a=1&b=2#xx");
console.log(url.origin); // https://example.com:8888
// url.origin = "http://example.com:9999"; // 将抛出 TypeError 错误
url.port = 9999;
url.protocol = "http";
console.log(url.href); // http://example.com:9999/path?a=1&b=2#xx
